var ssxForm;
var gxdwForm;

$(init);

function init(){
    $("#listGrid").jqGrid(
    {
        url : ctx+"/common/extQuery?sqlid=gqbgxx",
        postData : $("#searchForm").getFormJson(),
        autowidth:true,
        height:(($(window.document).height())-150),
        datatype: "json",    
        colNames : ['税源企业','变更项','变更前','变更后','变更时间','操作'],
        colModel : [ 
            {name : "QYJC",index : "QYJC",width : 100,sortable:false}, 
            {name : "BGX",index : "BGX",width : 200,sortable:false}, 
            {name : "BGQ",index : "BGQ",width : 300,sortable:false}, 
            {name : "BGH",index : "BGH",width : 300,sortable:false}, 
            {name : "BGRQ",index : "BGRQ",width : 100,align:"center",sortable:false}, 
        	{name: 'cz', index: 'cz', width: 100, sortable: false, align: "center", title: false, formatter: function (value, options, row) {
                return "<span class='tdcz'>" +
                        "<a title='源网页' class='small_btn tax' href=\"javascript:openUrl('" + row.URL + "');\">源网页</a>" +
                        "</span>";
            }}
        ],
        prmNames:{
            rows:"limit"
        },
        jsonReader :{
            root: "message.list",   
            page: "message.pageNumber",   
            total: "message.totalPage",
            records:"message.totalRow"
        },
        loadtext:"<img src='"+ctx+"/static/images/loading.gif'>&nbsp;&nbsp;拼命加载中...",
        rowNum : 50,
        rowList : [ 50, 100, 150 ],
        pager : "#gridPager",
        mtype: "POST",
        viewrecords : true,
        sortable:false
     });
     //自适应屏幕
     $(window).resize(function(){
        $("#listGrid").setGridWidth($(window).width()*0.99);
     });
}

//打开更多条件信息
function openGDTJ(){
    qyOpen("高级搜索",620,"divGdContent");
}

//高级查询
function refreshGridGd(){
    var data = $("#searchFormGd").getFormJson();
    refreshGridByJson(data);
    qyClose();
}

//刷新资源信息
function refreshGrid(){
    var data = $("#searchForm").getFormJson();
    refreshGridByJson(data);
}

function refreshGridByJson(data){
	$("#listGrid").setGridParam({"postData":data}).trigger("reloadGrid",[{page:1}]);
}

//重置
function searchFormReset(){
	formReset("searchForm");
	formReset("searchFormGd");
}
